package com.rd.student.jike.class1.fangzhou.day07_13;

import java.util.Scanner;

public class Code02 {
    public static void main(String[] args) {
        System.out.println("请输入金字塔的层数：");
        Scanner sc = new Scanner(System.in);
        int cengshu = sc.nextInt();
        //外层循环：控制层数
        for(int i = cengshu; i > 0;i--){
            //控制空格
            for(int j = 0;j < (i - 1)*4;j++){
                System.out.print(" ");
            }
            //控制金字塔的前半部分
            for(int k = cengshu-i+1;k >= 1;k--){
                System.out.print(k);
                System.out.print("   ");
            }
            //控制后半部分
            for(int k = 2;k <= cengshu-i+1;k++){
                System.out.print(k);
                System.out.print("   ");
            }
            System.out.println();
        }
    }
}
